﻿<include file="Public:header" />
<!-- MAIN CONTENT start -->
<script>

    function mail_sort(type){
        location.href= 'index?type='+type;
    }
</script>
<literal>
    <style>
        .href-class tr td :hover{
            background: red;
        }
    </style>
</literal>

<div class="span3">
    <div class="well" style="padding: 8px 0;">
        <ul class="nav nav-list">
            <p>
                <div class="btn-group" data-toggle="buttons-radio">
                    <button class="btn active" style="width: 120px;" onclick="location.href='{:U(\'Mail/index\')}'">
                        <span class="icon-inbox"></span>收信
                    </button>
                    <button class="btn" style="width: 120px;" onclick="location.href='{:U(\'Mail/add\')}'">
                        <span class="icon-edit"></span>发信
                    </button>
                </div>
            </p>
            <li class="nav-header">
                个人信息
            </li>
            <li>
                <i class="icon-time"></i>名次：{$solution.rangking}
            </li>
            <li class="divider">
            </li>
            <li>
                <a href="{:U('/Status/index/',array('user_id'=>$user['user_id'],'result'=>4))}">
                    <i class="icon-check"></i>解决：{$solution.ac_num}
                </a>

            </li>
            <li>
                <a href="{:U('/Status/index/',array('user_id'=>$user['user_id']))}">
                    <i class="icon-list-alt"></i>提交：{$solution.sub_num}
                </a>
                <ul class="nav nav-list">
                    <foreach name="solution.solution_info" item="v_so">
                        <li>
                            <i class="icon-flag"></i>{$v_so.name}：{$v_so.num}
                        </li>
                    </foreach>
                </ul>
            </li>
            <li class="divider">
            </li>
            <li>
                <i class="icon-folder-open"></i>学校：{$user.school}
            </li>
            <li class="active">
                <i class="icon-ok"></i>邮箱：{$user.email}
            </li>
            <li class="divider">
            </li>
            <li>
                <a href="#">
                    <i class="icon-comment"></i>论坛
                </a>
            </li>
        </ul>
    </div>
</div>
<!--收信-->
<div class="span9" id="mail_list">
    <h3>
        {$user.user_id}--{$user.nick}&nbsp;&nbsp;&nbsp;Messages
    </h3>
    <legend>
        Mail list
        <div class="btn-group" data-toggle="buttons-radio" style="float: right;">
            <button class="btn <if condition='0===$type'>active</if> " onclick="javascript:mail_sort(0)">
                <i class="icon-list"></i>全部<span class="badge badge-info">{$total|intval}</span>
            </button>
            <button class="btn <if condition='1===$type'>active</if> " onclick="javascript:mail_sort(1)">
                <i class="icon-folder-close"></i>已读<span class="badge badge-success">{$read|intval}</span>
            </button>
            <button class="btn <if condition='2===$type'>active</if> " onclick="javascript:mail_sort(2)">
                <i class="icon-folder-open"></i>未读<span class="badge badge-warning">{$unread|intval}</span>
            </button>
            <button class="btn <if condition='3===$type'>active</if> " onclick="javascript:mail_sort(3)">
                <i class="icon-list-alt"></i>已发送<span class="badge badge-warning">{$sent|intval}</span>
            </button>
        </div>
    </legend>
    <table class="table table-striped table-hover">
        <thead>
            <tr>
            </tr>
        </thead>
        <tbody>
            <foreach name="mail_list" key="k" item="mail_v">
                <tr onclick="location.href='{:U(\'Mail/view\',array(\'id\'=>$mail_v[mail_id]))}'" class="href-class">
                    <td>
                        {$mail_v.mail_id}
                        <if condition=" 1==$mail_v['new_mail'] && $session['user_id']!=$mail_v['from_user']">
                            <i class="icon-envelope"></i>
                        </if>
                    </td>
                    <if condition="$session['user_id']==$mail_v['from_user']">
                        <td><i class="icon-share"></i>{$mail_v.to_user}</td>
                     <elseif condition="$session['user_id']==$mail_v['to_user']" />
                        <td><i class="icon-check"></i>{$mail_v.from_user}</td>
                    </if>
                    <td>{$mail_v.title|mb_substr=###,0,10,'UTF-8'}</td>
                    <td>{$mail_v.content|mb_substr=###,0,10,'UTF-8'}...</td>

                    <td>
                        <if condition="$session['user_id'] != $mail_v['from_user']">
                            <a href="{:U('Mail/reply',array('id'=>$mail_v['from_user']))}"><i class="icon-edit"></i></a>
                        </if>
                        <a href="{:U('Mail/delete',array('id'=>$mail_v['mail_id']))}"><i class="icon-trash"></i></a>
                    </td>
                    <td style="color: #bbb">{$mail_v.in_date|timeExchange}</td>
                </tr>
            </foreach>
            <tr>
                <td colspan="6">{$page->show()}</td>
            </tr>
        </tbody>
    </table>
</div>
<!-- MAIN CONTENT -->
<include file="Public:footer" />